<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/api.js"></script>
    <style type="text/css">
        .header {
            padding: 2.5rem 0.5rem 2rem 0.5rem;
        }
    </style>
</head>

<body>
    <header class="aui-bar aui-bar-nav" style="padding-top:25px;">
        <a class="aui-pull-left aui-btn" onclick="closeWin()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title">E文通</div>
        <a class="aui-pull-right aui-btn"></a>
    </header>
<div class="head-d"></div>


    <div class="aui-content aui-margin-b-15">
        <ul class="aui-list aui-list-in">
            <!-- <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-label">
                    旧密码
                </div>
                <div class="aui-list-item-input">
                    <input type="text" placeholder="请输入旧密码" id="oldPWD">
                </div>
            </div>
        </li> -->
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        新密码
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" placeholder="请输入新密码" id="newPWD" type="password">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        重复密码
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" placeholder="请重复输入密码" id="conPWD" type="password">
                    </div>
                </div>
            </li>
        </ul>
    </div>
    <div class="aui-btn aui-btn-success" style="width:6rem; margin:1.5rem auto 0; display:block;" onclick="sub();">确认修改</div>




</body>

<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript">
    function openClub() {
        var delay = 0;
        if (api.systemType != 'ios') {
            delay = 300;
        }
        api.openWin({
            name: 'club_win',
            url: './html/club_win.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    }

    function closeWin() {
        api.closeWin({});
    }

    function sub() {
        var newPWD = $("#newPWD").val();
        var conPWD = $("#conPWD").val();

        if (newPWD != conPWD) {
            alert("两次输入的密码不一致！");
        } else {
            var id = $api.getStorage('id');
            var url = 'http://oa.big-wealth.com/index.php?m=&c=Profile&a=reset_pwd_api&&api_auth_id=' + id;
            api.ajax({
                url: url,
                method: 'post',
                data: {
                    values: {
                        password: newPWD
                    }
                }
            }, function(ret, err) {
                if (ret) {
                    // alert( JSON.stringify( ret ) );
                    if (ret.status == 200) {
                        alert(ret.success);
                        var newPWD = $("#newPWD").val("");
                        var conPWD = $("#conPWD").val("");
                        api.closeWin({});
                    } else {
                        alert(ret.error);
                    }

                } else {
                    // alert( JSON.stringify( err ) );
                }
            });

        }
    }
</script>

</html>
